<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ts_categoryattr.*" %>
<%@page import="java.util.*" %> 
<%@page import="com.lmpop.trade.ts_category.Ts_categoryInfo" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ts_categoryattr ts_categoryattr = new Ts_categoryattr();
	Ts_categoryInfo ts_categoryInfo  = new  Ts_categoryInfo ();
	
	String cat_id="";
	if (request.getParameter("cat_id") != null){
		cat_id = request.getParameter("cat_id");
	} 
	
	String cat_name = ts_categoryInfo.getCatNameById(cat_id);
	String up_cat_id="";
	if (request.getParameter("up_cat_id") != null){
		up_cat_id = request.getParameter("up_cat_id");
	}

	Ts_categoryattrInfo ts_categoryattrInfo = new Ts_categoryattrInfo();
	
	List list = ts_categoryattrInfo.getListByClassId(cat_id);
	
%>
<html>
  <head>
    
    <title>ts_categoryattr Manager</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="js_categoryattr.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>[<%=cat_name%>]属性管理</h1>
			</td>
			<td>
				
				<a href="addInfo.jsp?cat_id=<%=cat_id%>&up_cat_id=<%=up_cat_id%>"><img src="/program/admin/index/images/post.gif" /></a>
			
			</td>
		</tr>
	</table>
	
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/> 
	      <input type="button" name="sortN" onclick="sortNews(this)" value="排序" class="buttab"/>

				<input type="button" name="re" onclick="window.location.href='index.jsp?up_classId=<%=up_cat_id%>'" value="返回" class="buttab"/>

			</td>
			
		</tr>
	</table> 
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>

	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>属性名称</th>
		  	
		  	<th>默认标志</th>
		  	
		  	<th>内容类型</th>
        
        <th>显示顺序</th>
      
			  <th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String class_id="",attr_id="",attr_name="",attr_no="",default_tag="",default_value="",enable_tag="",con_type="";
		  			if(map.get("class_id")!=null) class_id = map.get("class_id").toString();
				  	if(map.get("attr_id")!=null) attr_id = map.get("attr_id").toString();
				  	if(map.get("attr_name")!=null) attr_name = map.get("attr_name").toString();
				  	if(map.get("attr_no")!=null) attr_no = map.get("attr_no").toString();
				  	if(map.get("default_tag")!=null) default_tag = map.get("default_tag").toString();
				  	if(map.get("con_type")!=null) con_type = map.get("con_type").toString();
            String tag_name="",type_name="";
		        if(default_tag.equals("0")){
               tag_name ="必填";		        
		        }else if(default_tag.equals("1")){
               tag_name ="不必填";			      
		        }
		        if(con_type.equals("0")){
               type_name ="单选框 ";			        
		        }else if(con_type.equals("1")){
               type_name ="输入框";		      
		        }else if(con_type.equals("2")){
               type_name ="多选框";		      
		        }    		  
		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=attr_id %>" /></td>
			
		  	<td><%=attr_name%></td>
		  	
		  	<td><%=tag_name%></td>
		  	
		  	<td><%=type_name%></td>
		  	
		  	<td><input type="text" id="<%=attr_id%>" name="<%=attr_id%>" value="<%=attr_no%>" size="4" maxlength="4" onKeyUp="if(!/^[1-9][0-9]*$/.test(this.value))this.value=''"></td>
		  		  	
			<td width="10%"><a href="updateInfo.jsp?attr_id=<%=attr_id%>&cat_id=<%=cat_id%>&up_cat_id=<%=up_cat_id%>"><img src="/program/admin/images/edit.gif" title="修改" border="0"/></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=attr_id%>');"><img src="/program/admin/images/delete.gif" title="删除" border="0"/></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="dl_bg">
		<tr>
			<td width="90%">
				 <input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
	       <input type="button" name="sortN" onclick="sortNews(this)" value="排序" class="buttab"/>
				 <input type="button" name="re" onclick="window.location.href='index.jsp?up_classId=<%=up_cat_id%>'" value="返回" class="buttab"/>
			</td>
		</tr>
	</table>
	
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
    <input type="hidden" name="sort" id="sort" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="5120" />
	  </form>
</body>

</html>
